package com.vimi8.chick.plugins.module;

import android.support.v4.app.FragmentManager;

import com.alibaba.weex.plugin.annotation.WeexModule;
import com.eros.framework.activity.AbstractWeexActivity;
import com.taobao.weex.annotation.JSMethod;
import com.taobao.weex.bridge.JSCallback;
import com.taobao.weex.common.WXModule;
import com.vimi8.chick.plugins.adapter.DialogAdapter;

@WeexModule(name = "vmDialog", lazyLoad = true)
public class DialogModule extends WXModule {

    @JSMethod
    public void show(String params, JSCallback jsPositive, JSCallback jsNegative, JSCallback jsNeutral, JSCallback jsDismiss) {
        DialogAdapter.INSTANCE.show(params, mWXSDKInstance.getContext(), jsPositive, jsNegative, jsNeutral, jsDismiss);
    }

    @JSMethod
    public void list(String params, JSCallback jsPositive, JSCallback jsDismiss) {
        DialogAdapter.INSTANCE.list(params, mWXSDKInstance.getContext(), jsPositive, jsDismiss);
    }

    @JSMethod
    public void radio(String params, JSCallback jsPositive, JSCallback jsNegative, JSCallback jsDismiss) {
        DialogAdapter.INSTANCE.radio(params, mWXSDKInstance.getContext(), jsPositive, jsNegative, jsDismiss);
    }

    @JSMethod
    public void select(String params, JSCallback jsPositive, JSCallback jsNegative, JSCallback jsDismiss) {
        DialogAdapter.INSTANCE.select(params, mWXSDKInstance.getContext(), jsPositive, jsNegative, jsDismiss);
    }

    @JSMethod
    public void dateRange(String params, JSCallback jsPositive, JSCallback jsDismiss, JSCallback jsReset) {
        FragmentManager fragmentManager = ((AbstractWeexActivity) mWXSDKInstance.getContext()).getSupportFragmentManager();
        DialogAdapter.INSTANCE.dateRange(params, fragmentManager, jsPositive, jsDismiss, jsReset);
    }

    @JSMethod
    public void datePick(String params, JSCallback jsPositive, JSCallback jsDismiss) {
        DialogAdapter.INSTANCE.datePick(params, (AbstractWeexActivity) mWXSDKInstance.getContext(), jsPositive, jsDismiss);
    }

}
